/**
 *  原生接口 API 工具类
 *  DateTime：2023-10-08
 */

/**
 * 调整设备状态 API
 * @param val
 * @constructor
 */
function StatusApi (val) {
    if (val === 1) {
        StartRunApi();
    }
    if (val === 2) {
        StopRunApi();
    }
    if (val === 3) {
        ResetApi();
    }
}

/**
 * 调用开启运行设备接口
 * @constructor
 */
function StartRunApi () {
    return window.MainProcess.srartRun();
}

/**
 *
 * 暂停设备
 * @constructor
 */
function StopRunApi () {
    return window.MainProcess.stopRun();
}

/**
 * 程序复位
 * @constructor
 */
function ResetApi () {
    return window.MainProcess.reset();
}

/**
 * 解锁拧紧抢
 * @param val
 * @constructor
 */
function UnLockTighteningApi (val) {
    return window.MainProcess.unLockTightening(parseInt(val));
}

/**
 * agv手动给到站信号
 * @constructor
 */
function AGVManualStationApi () {
    window.MainProcess.aGVManualStation();
}

/**
 * 获取服务配置
 * @returns {*}
 * @constructor
 */
function GetServiceConfigApi () {
    return window.MainProcess.getServiceConfig();
}

function DebugPackNumberApi (PackNumber) {
    return window.MainProcessController.debugPackNumber(PackNumber);
}

function DebugPNApi (PN) {
    return window.MainProcessController.debugPN(PN);
}

function DebugNoMesApi (isMes) {
    return window.MainProcessController.debugNoMes(isMes);
}

function StepWorkingApi (PackNumber) {
    return window.MainProcessController.stepWorking(PackNumber);
}

/**
 * 打开气缸
 * @constructor
 */
function PassCylinderApi () {
    window.MainProcessController.passCylinder();
}

/**
 * 放行小车
 * @constructor
 */
function PassAGVApi () {
    window.MainProcessController.passAGV();
}

/**
 * 设置字典值
 * @param dicts
 * @constructor
 */
function SetDictModelApi (dicts) {
    return window.OtherApi.setDictModel(JSON.stringify(dicts));
}

/**
 * 获取字典值
 * @param keys
 * @constructor
 */
function GetDictModelApi (keys) {
    return window.OtherApi.getDictModel(keys);
}
